#pragma once

#include "BasicObject.h"
#include "transform.h"
#include "agent.h"
#include "personalitytraitmotivational.h"
#include "emotion.h"
#include "gametime.h"


namespace BAA
{
	
	

	class Agent;

	class AgentProperties:public BasicObject
	{


	public:

		AgentProperties(const std::string name):BasicObject(name)
		{

		}

		void Create();

		void Clear();

		void Initialize(Agent * agent);

		inline const Agent * ParentAgent() const 
		{ 
			return mParentAgent; 
		}

		inline void ParentAgent(const Agent * val) 
		{ 
			mParentAgent = val; 
		}

		inline Transform * GetTransform()
		{ 
			return &mTransform; 
		}

		inline void SetTransform(Transform * val) 
		{ 
			mTransform.setDir( val->getDir() ); 
			mTransform.setPos( val->getPos() );
		}


		~AgentProperties()
		{
			if(mAnger != NULL)
				mAnger->~Emotion();

			if(mFear != NULL)
				mFear->~Emotion();

			if(mSadness != NULL)
				mSadness->~Emotion();

			if(mDisgust != NULL)
				mDisgust->~Emotion();

			if(mSurprise != NULL)
				mSurprise->~Emotion();

			if(mHappyness != NULL)
				mHappyness->~Emotion();


			if(mPower != NULL)
				mPower->~PersonalityTraitMotivational();

			if(mCuriosity != NULL)
				mCuriosity->~PersonalityTraitMotivational();

			if(mIndependence != NULL)
				mIndependence->~PersonalityTraitMotivational();

			if(mStatus != NULL)
				mStatus->~PersonalityTraitMotivational();

			if(mSocialContact != NULL)
				mSocialContact->~PersonalityTraitMotivational();

			if(mVengeance != NULL)
				mVengeance->~PersonalityTraitMotivational();

			if(mIdealism != NULL)
				mIdealism->~PersonalityTraitMotivational();

			if(mPhysicalExercise != NULL)
				mPhysicalExercise->~PersonalityTraitMotivational();

			if(mRomance != NULL)
				mRomance->~PersonalityTraitMotivational();

			if(mFamily != NULL)
				mFamily->~PersonalityTraitMotivational();

			if(mOrder != NULL)
				mOrder->~PersonalityTraitMotivational();

			if(mEating != NULL)
				mEating->~PersonalityTraitMotivational();

			if(mAcceptance != NULL)
				mAcceptance->~PersonalityTraitMotivational();

			if(mTranquility != NULL)
				mTranquility->~PersonalityTraitMotivational();

			if(mSaving!= NULL)
				mSaving->~PersonalityTraitMotivational();
		}



		void Update(GameTime time);

		StringFloatMap * StateMap()  { return &mStateMap; }
		void StateMap(StringFloatMap  val) { mStateMap = val; }

		
		Emotion *  mAnger;
		Emotion *  mFear;
		Emotion *  mSadness;
		Emotion *  mDisgust;
		Emotion *  mSurprise;
		Emotion *  mHappyness;

		PersonalityTraitMotivational *  mPower;
		PersonalityTraitMotivational *  mCuriosity;
		PersonalityTraitMotivational *  mIndependence;
		PersonalityTraitMotivational *  mStatus;
		PersonalityTraitMotivational *  mSocialContact;
		PersonalityTraitMotivational *  mVengeance;
		PersonalityTraitMotivational *  mHonor;
		PersonalityTraitMotivational *  mIdealism;
		PersonalityTraitMotivational *  mPhysicalExercise;
		PersonalityTraitMotivational *  mRomance;
		PersonalityTraitMotivational *  mFamily;
		PersonalityTraitMotivational *  mOrder;
		PersonalityTraitMotivational *  mEating;
		PersonalityTraitMotivational *  mAcceptance;
		PersonalityTraitMotivational *  mTranquility;
		PersonalityTraitMotivational *  mSaving;

		protected:
			const Agent * mParentAgent;

			Transform		mTransform;
			StringFloatMap  mStateMap;

	};// end class
}// end namespace
